package com.example.configclient9011.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

@RestController
@RefreshScope
@Slf4j
public class TestController {


    @Value("${server.port}")
    private String port;

    @Value("${testname}")
    private String testname;

    @Value("${spring.cloud.consul.host}")
    private String host;



    @GetMapping("/c9011/init")
    public String init() throws UnsupportedEncodingException {
        //  testname= new String(testname.getBytes("ISO-8859-1"), "UTF-8");
        return new String(testname.getBytes("ISO-8859-1"), "UTF-8")+ "   hello: " + port;
    }
}
